<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><link rel="stylesheet" type="text/css" href="style.css" /><script type="text/javascript" src="highlight.js"></script></head><body><pre><span class="hs-pragma">{-# LANGUAGE GADTs #-}</span><span>
</span><span id="line-2"></span><span class="hs-comment">-----------------------------------------------------------------------------</span><span>
</span><span id="line-3"></span><span class="hs-comment">-- |</span><span>
</span><span id="line-4"></span><span class="hs-comment">-- Module      :  Distribution.Simple.Program.Script</span><span>
</span><span id="line-5"></span><span class="hs-comment">-- Copyright   :  Duncan Coutts 2009</span><span>
</span><span id="line-6"></span><span class="hs-comment">--</span><span>
</span><span id="line-7"></span><span class="hs-comment">-- Maintainer  :  cabal-devel@haskell.org</span><span>
</span><span id="line-8"></span><span class="hs-comment">-- Portability :  portable</span><span>
</span><span id="line-9"></span><span class="hs-comment">--</span><span>
</span><span id="line-10"></span><span class="hs-comment">-- This module provides an library interface to the @hc-pkg@ program.</span><span>
</span><span id="line-11"></span><span class="hs-comment">-- Currently only GHC and LHC have hc-pkg programs.</span><span>
</span><span id="line-12"></span><span>
</span><span id="line-13"></span><span class="hs-keyword">module</span><span> </span><span class="hs-identifier">Distribution.Simple.Program.Script</span><span> </span><span class="hs-special">(</span><span>
</span><span id="line-14"></span><span>
</span><span id="line-15"></span><span>    </span><span class="annot"><a href="Distribution.Simple.Program.Script.html#invocationAsSystemScript"><span class="hs-identifier">invocationAsSystemScript</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-16"></span><span>    </span><span class="annot"><a href="Distribution.Simple.Program.Script.html#invocationAsShellScript"><span class="hs-identifier">invocationAsShellScript</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-17"></span><span>    </span><span class="annot"><a href="Distribution.Simple.Program.Script.html#invocationAsBatchFile"><span class="hs-identifier">invocationAsBatchFile</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-18"></span><span>  </span><span class="hs-special">)</span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-19"></span><span>
</span><span id="line-20"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Prelude.html#"><span class="hs-identifier">Prelude</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-21"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="Distribution.Compat.Prelude.html"><span class="hs-identifier">Distribution.Compat.Prelude</span></a></span><span>
</span><span id="line-22"></span><span>
</span><span id="line-23"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="Distribution.Simple.Program.Run.html"><span class="hs-identifier">Distribution.Simple.Program.Run</span></a></span><span>
</span><span id="line-24"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="Distribution.Simple.Utils.html"><span class="hs-identifier">Distribution.Simple.Utils</span></a></span><span>
</span><span id="line-25"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="Distribution.System.html"><span class="hs-identifier">Distribution.System</span></a></span><span>
</span><span id="line-26"></span><span>
</span><span id="line-27"></span><span class="hs-comment">-- | Generate a system script, either POSIX shell script or Windows batch file</span><span>
</span><span id="line-28"></span><span class="hs-comment">-- as appropriate for the given system.</span><span>
</span><span id="line-29"></span><span class="hs-comment">--</span><span>
</span><span id="line-30"></span><span class="annot"><a href="Distribution.Simple.Program.Script.html#invocationAsSystemScript"><span class="hs-identifier hs-type">invocationAsSystemScript</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Distribution.System.html#OS"><span class="hs-identifier hs-type">OS</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Distribution.Simple.Program.Run.html#ProgramInvocation"><span class="hs-identifier hs-type">ProgramInvocation</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span>
</span><span id="line-31"></span><span id="invocationAsSystemScript"><span class="annot"><span class="annottext">invocationAsSystemScript :: OS -&gt; ProgramInvocation -&gt; String
</span><a href="Distribution.Simple.Program.Script.html#invocationAsSystemScript"><span class="hs-identifier hs-var hs-var">invocationAsSystemScript</span></a></span></span><span> </span><span class="annot"><span class="annottext">OS
</span><a href="Distribution.System.html#Windows"><span class="hs-identifier hs-var">Windows</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ProgramInvocation -&gt; String
</span><a href="Distribution.Simple.Program.Script.html#invocationAsBatchFile"><span class="hs-identifier hs-var">invocationAsBatchFile</span></a></span><span>
</span><span id="line-32"></span><span class="annot"><a href="Distribution.Simple.Program.Script.html#invocationAsSystemScript"><span class="hs-identifier hs-var">invocationAsSystemScript</span></a></span><span> </span><span class="annot"><span class="annottext">OS
</span><span class="hs-identifier">_</span></span><span>       </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ProgramInvocation -&gt; String
</span><a href="Distribution.Simple.Program.Script.html#invocationAsShellScript"><span class="hs-identifier hs-var">invocationAsShellScript</span></a></span><span>
</span><span id="line-33"></span><span>
</span><span id="line-34"></span><span>
</span><span id="line-35"></span><span class="hs-comment">-- | Generate a POSIX shell script that invokes a program.</span><span>
</span><span id="line-36"></span><span class="hs-comment">--</span><span>
</span><span id="line-37"></span><span class="annot"><a href="Distribution.Simple.Program.Script.html#invocationAsShellScript"><span class="hs-identifier hs-type">invocationAsShellScript</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Distribution.Simple.Program.Run.html#ProgramInvocation"><span class="hs-identifier hs-type">ProgramInvocation</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span>
</span><span id="line-38"></span><span id="invocationAsShellScript"><span class="annot"><span class="annottext">invocationAsShellScript :: ProgramInvocation -&gt; String
</span><a href="Distribution.Simple.Program.Script.html#invocationAsShellScript"><span class="hs-identifier hs-var hs-var">invocationAsShellScript</span></a></span></span><span>
</span><span id="line-39"></span><span>  </span><span class="annot"><a href="Distribution.Simple.Program.Run.html#ProgramInvocation"><span class="hs-identifier hs-type">ProgramInvocation</span></a></span><span> </span><span class="hs-special">{</span><span>
</span><span id="line-40"></span><span>    </span><span class="annot"><span class="annottext">progInvokePath :: ProgramInvocation -&gt; String
</span><a href="Distribution.Simple.Program.Run.html#progInvokePath"><span class="hs-identifier hs-var">progInvokePath</span></a></span><span>  </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621679685063"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679685063"><span class="hs-identifier hs-var">path</span></a></span></span><span class="hs-special">,</span><span>
</span><span id="line-41"></span><span>    </span><span class="annot"><span class="annottext">progInvokeArgs :: ProgramInvocation -&gt; [String]
</span><a href="Distribution.Simple.Program.Run.html#progInvokeArgs"><span class="hs-identifier hs-var">progInvokeArgs</span></a></span><span>  </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621679685061"><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621679685061"><span class="hs-identifier hs-var">args</span></a></span></span><span class="hs-special">,</span><span>
</span><span id="line-42"></span><span>    </span><span class="annot"><span class="annottext">progInvokeEnv :: ProgramInvocation -&gt; [(String, Maybe String)]
</span><a href="Distribution.Simple.Program.Run.html#progInvokeEnv"><span class="hs-identifier hs-var">progInvokeEnv</span></a></span><span>   </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621679685059"><span class="annot"><span class="annottext">[(String, Maybe String)]
</span><a href="#local-6989586621679685059"><span class="hs-identifier hs-var">envExtra</span></a></span></span><span class="hs-special">,</span><span>
</span><span id="line-43"></span><span>    </span><span class="annot"><span class="annottext">progInvokeCwd :: ProgramInvocation -&gt; Maybe String
</span><a href="Distribution.Simple.Program.Run.html#progInvokeCwd"><span class="hs-identifier hs-var">progInvokeCwd</span></a></span><span>   </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621679685057"><span class="annot"><span class="annottext">Maybe String
</span><a href="#local-6989586621679685057"><span class="hs-identifier hs-var">mcwd</span></a></span></span><span class="hs-special">,</span><span>
</span><span id="line-44"></span><span>    </span><span class="annot"><span class="annottext">progInvokeInput :: ProgramInvocation -&gt; Maybe IOData
</span><a href="Distribution.Simple.Program.Run.html#progInvokeInput"><span class="hs-identifier hs-var">progInvokeInput</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621679685055"><span class="annot"><span class="annottext">Maybe IOData
</span><a href="#local-6989586621679685055"><span class="hs-identifier hs-var">minput</span></a></span></span><span>
</span><span id="line-45"></span><span>  </span><span class="hs-special">}</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[String] -&gt; String
</span><a href="../../base/src/Data.OldList.html#unlines"><span class="hs-identifier hs-var">unlines</span></a></span><span> </span><span class="annot"><span class="annottext">([String] -&gt; String) -&gt; [String] -&gt; String
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-46"></span><span>          </span><span class="hs-special">[</span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;#!/bin/sh&quot;</span></span><span> </span><span class="hs-special">]</span><span>
</span><span id="line-47"></span><span>       </span><span class="annot"><span class="annottext">[String] -&gt; [String] -&gt; [String]
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">((String, Maybe String) -&gt; [String])
-&gt; [(String, Maybe String)] -&gt; [String]
forall (t :: * -&gt; *) a b. Foldable t =&gt; (a -&gt; [b]) -&gt; t a -&gt; [b]
</span><a href="../../base/src/Data.Foldable.html#concatMap"><span class="hs-identifier hs-var">concatMap</span></a></span><span> </span><span class="annot"><span class="annottext">(String, Maybe String) -&gt; [String]
</span><a href="#local-6989586621679685052"><span class="hs-identifier hs-var">setEnv</span></a></span><span> </span><span class="annot"><span class="annottext">[(String, Maybe String)]
</span><a href="#local-6989586621679685059"><span class="hs-identifier hs-var">envExtra</span></a></span><span>
</span><span id="line-48"></span><span>       </span><span class="annot"><span class="annottext">[String] -&gt; [String] -&gt; [String]
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="hs-special">[</span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;cd &quot;</span></span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; String
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; String
</span><a href="#local-6989586621679685051"><span class="hs-identifier hs-var">quote</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679685050"><span class="hs-identifier hs-var">cwd</span></a></span><span> </span><span class="hs-glyph">|</span><span> </span><span id="local-6989586621679685050"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679685050"><span class="hs-identifier hs-var">cwd</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Maybe String -&gt; [String]
forall a. Maybe a -&gt; [a]
</span><a href="../../base/src/Data.Maybe.html#maybeToList"><span class="hs-identifier hs-var">maybeToList</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe String
</span><a href="#local-6989586621679685057"><span class="hs-identifier hs-var">mcwd</span></a></span><span> </span><span class="hs-special">]</span><span>
</span><span id="line-49"></span><span>       </span><span class="annot"><span class="annottext">[String] -&gt; [String] -&gt; [String]
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="hs-special">[</span><span> </span><span class="hs-special">(</span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">Maybe IOData
</span><a href="#local-6989586621679685055"><span class="hs-identifier hs-var">minput</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-50"></span><span>              </span><span class="annot"><span class="annottext">Maybe IOData
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>     </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;&quot;</span></span><span>
</span><span id="line-51"></span><span>              </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621679685048"><span class="annot"><span class="annottext">IOData
</span><a href="#local-6989586621679685048"><span class="hs-identifier hs-var">input</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;echo &quot;</span></span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; String
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; String
</span><a href="#local-6989586621679685051"><span class="hs-identifier hs-var">quote</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">IOData -&gt; String
</span><a href="Distribution.Simple.Program.Script.html#iodataToText"><span class="hs-identifier hs-var">iodataToText</span></a></span><span> </span><span class="annot"><span class="annottext">IOData
</span><a href="#local-6989586621679685048"><span class="hs-identifier hs-var">input</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; String
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot; | &quot;</span></span><span class="hs-special">)</span><span>
</span><span id="line-52"></span><span>         </span><span class="annot"><span class="annottext">String -&gt; String -&gt; String
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">[String] -&gt; String
</span><a href="../../base/src/Data.OldList.html#unwords"><span class="hs-identifier hs-var">unwords</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(String -&gt; String) -&gt; [String] -&gt; [String]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; String
</span><a href="#local-6989586621679685051"><span class="hs-identifier hs-var">quote</span></a></span><span> </span><span class="annot"><span class="annottext">([String] -&gt; [String]) -&gt; [String] -&gt; [String]
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679685063"><span class="hs-identifier hs-var">path</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; [String] -&gt; [String]
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span> </span><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621679685061"><span class="hs-identifier hs-var">args</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; String
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot; \&quot;$@\&quot;&quot;</span></span><span class="hs-special">]</span><span>
</span><span id="line-53"></span><span>
</span><span id="line-54"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-55"></span><span>    </span><span id="local-6989586621679685052"><span class="annot"><span class="annottext">setEnv :: (String, Maybe String) -&gt; [String]
</span><a href="#local-6989586621679685052"><span class="hs-identifier hs-var hs-var">setEnv</span></a></span></span><span> </span><span class="hs-special">(</span><span id="local-6989586621679685045"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679685045"><span class="hs-identifier hs-var">var</span></a></span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Maybe String
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span class="hs-special">)</span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;unset &quot;</span></span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; String
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679685045"><span class="hs-identifier hs-var">var</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;export &quot;</span></span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; String
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679685045"><span class="hs-identifier hs-var">var</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-56"></span><span>    </span><span class="annot"><a href="#local-6989586621679685052"><span class="hs-identifier hs-var">setEnv</span></a></span><span> </span><span class="hs-special">(</span><span id="local-6989586621679685044"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679685044"><span class="hs-identifier hs-var">var</span></a></span></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621679685043"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679685043"><span class="hs-identifier hs-var">val</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;export &quot;</span></span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; String
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679685044"><span class="hs-identifier hs-var">var</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; String
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;=&quot;</span></span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; String
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; String
</span><a href="#local-6989586621679685051"><span class="hs-identifier hs-var">quote</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679685043"><span class="hs-identifier hs-var">val</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-57"></span><span>
</span><span id="line-58"></span><span>    </span><span class="annot"><a href="#local-6989586621679685051"><span class="hs-identifier hs-type">quote</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span>
</span><span id="line-59"></span><span>    </span><span id="local-6989586621679685051"><span class="annot"><span class="annottext">quote :: String -&gt; String
</span><a href="#local-6989586621679685051"><span class="hs-identifier hs-var hs-var">quote</span></a></span></span><span> </span><span id="local-6989586621679685042"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679685042"><span class="hs-identifier hs-var">s</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;'&quot;</span></span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; String
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; String
</span><a href="#local-6989586621679685041"><span class="hs-identifier hs-var">escape</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679685042"><span class="hs-identifier hs-var">s</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; String
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;'&quot;</span></span><span>
</span><span id="line-60"></span><span>
</span><span id="line-61"></span><span>    </span><span id="local-6989586621679685041"><span class="annot"><span class="annottext">escape :: String -&gt; String
</span><a href="#local-6989586621679685041"><span class="hs-identifier hs-var hs-var">escape</span></a></span></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>
</span><span id="line-62"></span><span>    </span><span class="annot"><a href="#local-6989586621679685041"><span class="hs-identifier hs-var">escape</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Char
</span><span class="hs-char">'\''</span></span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span id="local-6989586621679685040"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679685040"><span class="hs-identifier hs-var">cs</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;'\\''&quot;</span></span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; String
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; String
</span><a href="#local-6989586621679685041"><span class="hs-identifier hs-var">escape</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679685040"><span class="hs-identifier hs-var">cs</span></a></span><span>
</span><span id="line-63"></span><span>    </span><span class="annot"><a href="#local-6989586621679685041"><span class="hs-identifier hs-var">escape</span></a></span><span> </span><span class="hs-special">(</span><span id="local-6989586621679685039"><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621679685039"><span class="hs-identifier hs-var">c</span></a></span></span><span>   </span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span id="local-6989586621679685038"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679685038"><span class="hs-identifier hs-var">cs</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621679685039"><span class="hs-identifier hs-var">c</span></a></span><span>        </span><span class="annot"><span class="annottext">Char -&gt; String -&gt; String
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span> </span><span class="annot"><span class="annottext">String -&gt; String
</span><a href="#local-6989586621679685041"><span class="hs-identifier hs-var">escape</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679685038"><span class="hs-identifier hs-var">cs</span></a></span><span>
</span><span id="line-64"></span><span>
</span><span id="line-65"></span><span class="annot"><a href="Distribution.Simple.Program.Script.html#iodataToText"><span class="hs-identifier hs-type">iodataToText</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Distribution.Utils.IOData.html#IOData"><span class="hs-identifier hs-type">IOData</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span>
</span><span id="line-66"></span><span id="iodataToText"><span class="annot"><span class="annottext">iodataToText :: IOData -&gt; String
</span><a href="Distribution.Simple.Program.Script.html#iodataToText"><span class="hs-identifier hs-var hs-var">iodataToText</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Distribution.Utils.IOData.html#IODataText"><span class="hs-identifier hs-type">IODataText</span></a></span><span> </span><span id="local-6989586621679685036"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679685036"><span class="hs-identifier hs-var">str</span></a></span></span><span class="hs-special">)</span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679685036"><span class="hs-identifier hs-var">str</span></a></span><span>
</span><span id="line-67"></span><span class="annot"><a href="Distribution.Simple.Program.Script.html#iodataToText"><span class="hs-identifier hs-var">iodataToText</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Distribution.Utils.IOData.html#IODataBinary"><span class="hs-identifier hs-type">IODataBinary</span></a></span><span> </span><span id="local-6989586621679685034"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679685034"><span class="hs-identifier hs-var">lbs</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; String
</span><a href="Distribution.Utils.Generic.html#fromUTF8LBS"><span class="hs-identifier hs-var">fromUTF8LBS</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679685034"><span class="hs-identifier hs-var">lbs</span></a></span><span>
</span><span id="line-68"></span><span>
</span><span id="line-69"></span><span>
</span><span id="line-70"></span><span class="hs-comment">-- | Generate a Windows batch file that invokes a program.</span><span>
</span><span id="line-71"></span><span class="hs-comment">--</span><span>
</span><span id="line-72"></span><span class="annot"><a href="Distribution.Simple.Program.Script.html#invocationAsBatchFile"><span class="hs-identifier hs-type">invocationAsBatchFile</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Distribution.Simple.Program.Run.html#ProgramInvocation"><span class="hs-identifier hs-type">ProgramInvocation</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span>
</span><span id="line-73"></span><span id="invocationAsBatchFile"><span class="annot"><span class="annottext">invocationAsBatchFile :: ProgramInvocation -&gt; String
</span><a href="Distribution.Simple.Program.Script.html#invocationAsBatchFile"><span class="hs-identifier hs-var hs-var">invocationAsBatchFile</span></a></span></span><span>
</span><span id="line-74"></span><span>  </span><span class="annot"><a href="Distribution.Simple.Program.Run.html#ProgramInvocation"><span class="hs-identifier hs-type">ProgramInvocation</span></a></span><span> </span><span class="hs-special">{</span><span>
</span><span id="line-75"></span><span>    </span><span class="annot"><span class="annottext">progInvokePath :: ProgramInvocation -&gt; String
</span><a href="Distribution.Simple.Program.Run.html#progInvokePath"><span class="hs-identifier hs-var">progInvokePath</span></a></span><span>  </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621679685032"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679685032"><span class="hs-identifier hs-var">path</span></a></span></span><span class="hs-special">,</span><span>
</span><span id="line-76"></span><span>    </span><span class="annot"><span class="annottext">progInvokeArgs :: ProgramInvocation -&gt; [String]
</span><a href="Distribution.Simple.Program.Run.html#progInvokeArgs"><span class="hs-identifier hs-var">progInvokeArgs</span></a></span><span>  </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621679685031"><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621679685031"><span class="hs-identifier hs-var">args</span></a></span></span><span class="hs-special">,</span><span>
</span><span id="line-77"></span><span>    </span><span class="annot"><span class="annottext">progInvokeEnv :: ProgramInvocation -&gt; [(String, Maybe String)]
</span><a href="Distribution.Simple.Program.Run.html#progInvokeEnv"><span class="hs-identifier hs-var">progInvokeEnv</span></a></span><span>   </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621679685030"><span class="annot"><span class="annottext">[(String, Maybe String)]
</span><a href="#local-6989586621679685030"><span class="hs-identifier hs-var">envExtra</span></a></span></span><span class="hs-special">,</span><span>
</span><span id="line-78"></span><span>    </span><span class="annot"><span class="annottext">progInvokeCwd :: ProgramInvocation -&gt; Maybe String
</span><a href="Distribution.Simple.Program.Run.html#progInvokeCwd"><span class="hs-identifier hs-var">progInvokeCwd</span></a></span><span>   </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621679685029"><span class="annot"><span class="annottext">Maybe String
</span><a href="#local-6989586621679685029"><span class="hs-identifier hs-var">mcwd</span></a></span></span><span class="hs-special">,</span><span>
</span><span id="line-79"></span><span>    </span><span class="annot"><span class="annottext">progInvokeInput :: ProgramInvocation -&gt; Maybe IOData
</span><a href="Distribution.Simple.Program.Run.html#progInvokeInput"><span class="hs-identifier hs-var">progInvokeInput</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621679685028"><span class="annot"><span class="annottext">Maybe IOData
</span><a href="#local-6989586621679685028"><span class="hs-identifier hs-var">minput</span></a></span></span><span>
</span><span id="line-80"></span><span>  </span><span class="hs-special">}</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[String] -&gt; String
</span><a href="../../base/src/Data.OldList.html#unlines"><span class="hs-identifier hs-var">unlines</span></a></span><span> </span><span class="annot"><span class="annottext">([String] -&gt; String) -&gt; [String] -&gt; String
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-81"></span><span>          </span><span class="hs-special">[</span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;@echo off&quot;</span></span><span> </span><span class="hs-special">]</span><span>
</span><span id="line-82"></span><span>       </span><span class="annot"><span class="annottext">[String] -&gt; [String] -&gt; [String]
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">((String, Maybe String) -&gt; String)
-&gt; [(String, Maybe String)] -&gt; [String]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="annot"><span class="annottext">(String, Maybe String) -&gt; String
</span><a href="#local-6989586621679685027"><span class="hs-identifier hs-var">setEnv</span></a></span><span> </span><span class="annot"><span class="annottext">[(String, Maybe String)]
</span><a href="#local-6989586621679685030"><span class="hs-identifier hs-var">envExtra</span></a></span><span>
</span><span id="line-83"></span><span>       </span><span class="annot"><span class="annottext">[String] -&gt; [String] -&gt; [String]
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="hs-special">[</span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;cd \&quot;&quot;</span></span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; String
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679685026"><span class="hs-identifier hs-var">cwd</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; String
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;\&quot;&quot;</span></span><span> </span><span class="hs-glyph">|</span><span> </span><span id="local-6989586621679685026"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679685026"><span class="hs-identifier hs-var">cwd</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Maybe String -&gt; [String]
forall a. Maybe a -&gt; [a]
</span><a href="../../base/src/Data.Maybe.html#maybeToList"><span class="hs-identifier hs-var">maybeToList</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe String
</span><a href="#local-6989586621679685029"><span class="hs-identifier hs-var">mcwd</span></a></span><span> </span><span class="hs-special">]</span><span>
</span><span id="line-84"></span><span>       </span><span class="annot"><span class="annottext">[String] -&gt; [String] -&gt; [String]
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">Maybe IOData
</span><a href="#local-6989586621679685028"><span class="hs-identifier hs-var">minput</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-85"></span><span>            </span><span class="annot"><span class="annottext">Maybe IOData
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>    </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-86"></span><span>                </span><span class="hs-special">[</span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679685032"><span class="hs-identifier hs-var">path</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; String
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">(String -&gt; String) -&gt; [String] -&gt; String
forall (t :: * -&gt; *) a b. Foldable t =&gt; (a -&gt; [b]) -&gt; t a -&gt; [b]
</span><a href="../../base/src/Data.Foldable.html#concatMap"><span class="hs-identifier hs-var">concatMap</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Char
</span><span class="hs-char">' '</span></span><span class="annot"><span class="annottext">Char -&gt; String -&gt; String
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621679685031"><span class="hs-identifier hs-var">args</span></a></span><span> </span><span class="hs-special">]</span><span>
</span><span id="line-87"></span><span>
</span><span id="line-88"></span><span>            </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621679685025"><span class="annot"><span class="annottext">IOData
</span><a href="#local-6989586621679685025"><span class="hs-identifier hs-var">input</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-89"></span><span>                </span><span class="hs-special">[</span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;(&quot;</span></span><span> </span><span class="hs-special">]</span><span>
</span><span id="line-90"></span><span>             </span><span class="annot"><span class="annottext">[String] -&gt; [String] -&gt; [String]
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="hs-special">[</span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;echo &quot;</span></span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; String
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; String
</span><a href="#local-6989586621679685024"><span class="hs-identifier hs-var">escape</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679685023"><span class="hs-identifier hs-var">line</span></a></span><span> </span><span class="hs-glyph">|</span><span> </span><span id="local-6989586621679685023"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679685023"><span class="hs-identifier hs-var">line</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">String -&gt; [String]
</span><a href="../../base/src/Data.OldList.html#lines"><span class="hs-identifier hs-var">lines</span></a></span><span> </span><span class="annot"><span class="annottext">(String -&gt; [String]) -&gt; String -&gt; [String]
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">IOData -&gt; String
</span><a href="Distribution.Simple.Program.Script.html#iodataToText"><span class="hs-identifier hs-var">iodataToText</span></a></span><span> </span><span class="annot"><span class="annottext">IOData
</span><a href="#local-6989586621679685025"><span class="hs-identifier hs-var">input</span></a></span><span> </span><span class="hs-special">]</span><span>
</span><span id="line-91"></span><span>             </span><span class="annot"><span class="annottext">[String] -&gt; [String] -&gt; [String]
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="hs-special">[</span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;) | &quot;</span></span><span>
</span><span id="line-92"></span><span>               </span><span class="annot"><span class="annottext">String -&gt; String -&gt; String
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;\&quot;&quot;</span></span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; String
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679685032"><span class="hs-identifier hs-var">path</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; String
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;\&quot;&quot;</span></span><span>
</span><span id="line-93"></span><span>               </span><span class="annot"><span class="annottext">String -&gt; String -&gt; String
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">(String -&gt; String) -&gt; [String] -&gt; String
forall (t :: * -&gt; *) a b. Foldable t =&gt; (a -&gt; [b]) -&gt; t a -&gt; [b]
</span><a href="../../base/src/Data.Foldable.html#concatMap"><span class="hs-identifier hs-var">concatMap</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span id="local-6989586621679685021"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679685021"><span class="hs-identifier hs-var">arg</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Char
</span><span class="hs-char">' '</span></span><span class="annot"><span class="annottext">Char -&gt; String -&gt; String
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span class="annot"><span class="annottext">String -&gt; String
</span><a href="#local-6989586621679685020"><span class="hs-identifier hs-var">quote</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679685021"><span class="hs-identifier hs-var">arg</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621679685031"><span class="hs-identifier hs-var">args</span></a></span><span> </span><span class="hs-special">]</span><span>
</span><span id="line-94"></span><span>
</span><span id="line-95"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-96"></span><span>    </span><span id="local-6989586621679685027"><span class="annot"><span class="annottext">setEnv :: (String, Maybe String) -&gt; String
</span><a href="#local-6989586621679685027"><span class="hs-identifier hs-var hs-var">setEnv</span></a></span></span><span> </span><span class="hs-special">(</span><span id="local-6989586621679685019"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679685019"><span class="hs-identifier hs-var">var</span></a></span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Maybe String
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span class="hs-special">)</span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;set &quot;</span></span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; String
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679685019"><span class="hs-identifier hs-var">var</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; String
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;=&quot;</span></span><span>
</span><span id="line-97"></span><span>    </span><span class="annot"><a href="#local-6989586621679685027"><span class="hs-identifier hs-var">setEnv</span></a></span><span> </span><span class="hs-special">(</span><span id="local-6989586621679685018"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679685018"><span class="hs-identifier hs-var">var</span></a></span></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621679685017"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679685017"><span class="hs-identifier hs-var">val</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;set &quot;</span></span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; String
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679685018"><span class="hs-identifier hs-var">var</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; String
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;=&quot;</span></span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; String
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; String
</span><a href="#local-6989586621679685024"><span class="hs-identifier hs-var">escape</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679685017"><span class="hs-identifier hs-var">val</span></a></span><span>
</span><span id="line-98"></span><span>
</span><span id="line-99"></span><span>    </span><span class="annot"><a href="#local-6989586621679685020"><span class="hs-identifier hs-type">quote</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span>
</span><span id="line-100"></span><span>    </span><span id="local-6989586621679685020"><span class="annot"><span class="annottext">quote :: String -&gt; String
</span><a href="#local-6989586621679685020"><span class="hs-identifier hs-var hs-var">quote</span></a></span></span><span> </span><span id="local-6989586621679685016"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679685016"><span class="hs-identifier hs-var">s</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;\&quot;&quot;</span></span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; String
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; String
</span><a href="#local-6989586621679685015"><span class="hs-identifier hs-var">escapeQ</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679685016"><span class="hs-identifier hs-var">s</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; String
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;\&quot;&quot;</span></span><span>
</span><span id="line-101"></span><span>
</span><span id="line-102"></span><span>    </span><span id="local-6989586621679685015"><span class="annot"><span class="annottext">escapeQ :: String -&gt; String
</span><a href="#local-6989586621679685015"><span class="hs-identifier hs-var hs-var">escapeQ</span></a></span></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>       </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>
</span><span id="line-103"></span><span>    </span><span class="annot"><a href="#local-6989586621679685015"><span class="hs-identifier hs-var">escapeQ</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Char
</span><span class="hs-char">'&quot;'</span></span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span id="local-6989586621679685014"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679685014"><span class="hs-identifier hs-var">cs</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;\&quot;\&quot;\&quot;&quot;</span></span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; String
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; String
</span><a href="#local-6989586621679685015"><span class="hs-identifier hs-var">escapeQ</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679685014"><span class="hs-identifier hs-var">cs</span></a></span><span>
</span><span id="line-104"></span><span>    </span><span class="annot"><a href="#local-6989586621679685015"><span class="hs-identifier hs-var">escapeQ</span></a></span><span> </span><span class="hs-special">(</span><span id="local-6989586621679685013"><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621679685013"><span class="hs-identifier hs-var">c</span></a></span></span><span>  </span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span id="local-6989586621679685012"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679685012"><span class="hs-identifier hs-var">cs</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621679685013"><span class="hs-identifier hs-var">c</span></a></span><span>         </span><span class="annot"><span class="annottext">Char -&gt; String -&gt; String
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span> </span><span class="annot"><span class="annottext">String -&gt; String
</span><a href="#local-6989586621679685015"><span class="hs-identifier hs-var">escapeQ</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679685012"><span class="hs-identifier hs-var">cs</span></a></span><span>
</span><span id="line-105"></span><span>
</span><span id="line-106"></span><span>    </span><span id="local-6989586621679685024"><span class="annot"><span class="annottext">escape :: String -&gt; String
</span><a href="#local-6989586621679685024"><span class="hs-identifier hs-var hs-var">escape</span></a></span></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>
</span><span id="line-107"></span><span>    </span><span class="annot"><a href="#local-6989586621679685024"><span class="hs-identifier hs-var">escape</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Char
</span><span class="hs-char">'|'</span></span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span id="local-6989586621679685011"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679685011"><span class="hs-identifier hs-var">cs</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;^|&quot;</span></span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; String
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; String
</span><a href="#local-6989586621679685024"><span class="hs-identifier hs-var">escape</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679685011"><span class="hs-identifier hs-var">cs</span></a></span><span>
</span><span id="line-108"></span><span>    </span><span class="annot"><a href="#local-6989586621679685024"><span class="hs-identifier hs-var">escape</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Char
</span><span class="hs-char">'&lt;'</span></span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span id="local-6989586621679685010"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679685010"><span class="hs-identifier hs-var">cs</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;^&lt;&quot;</span></span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; String
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; String
</span><a href="#local-6989586621679685024"><span class="hs-identifier hs-var">escape</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679685010"><span class="hs-identifier hs-var">cs</span></a></span><span>
</span><span id="line-109"></span><span>    </span><span class="annot"><a href="#local-6989586621679685024"><span class="hs-identifier hs-var">escape</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Char
</span><span class="hs-char">'&gt;'</span></span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span id="local-6989586621679685009"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679685009"><span class="hs-identifier hs-var">cs</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;^&gt;&quot;</span></span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; String
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; String
</span><a href="#local-6989586621679685024"><span class="hs-identifier hs-var">escape</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679685009"><span class="hs-identifier hs-var">cs</span></a></span><span>
</span><span id="line-110"></span><span>    </span><span class="annot"><a href="#local-6989586621679685024"><span class="hs-identifier hs-var">escape</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Char
</span><span class="hs-char">'&amp;'</span></span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span id="local-6989586621679685008"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679685008"><span class="hs-identifier hs-var">cs</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;^&amp;&quot;</span></span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; String
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; String
</span><a href="#local-6989586621679685024"><span class="hs-identifier hs-var">escape</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679685008"><span class="hs-identifier hs-var">cs</span></a></span><span>
</span><span id="line-111"></span><span>    </span><span class="annot"><a href="#local-6989586621679685024"><span class="hs-identifier hs-var">escape</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Char
</span><span class="hs-char">'('</span></span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span id="local-6989586621679685007"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679685007"><span class="hs-identifier hs-var">cs</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;^(&quot;</span></span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; String
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; String
</span><a href="#local-6989586621679685024"><span class="hs-identifier hs-var">escape</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679685007"><span class="hs-identifier hs-var">cs</span></a></span><span>
</span><span id="line-112"></span><span>    </span><span class="annot"><a href="#local-6989586621679685024"><span class="hs-identifier hs-var">escape</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Char
</span><span class="hs-char">')'</span></span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span id="local-6989586621679685006"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679685006"><span class="hs-identifier hs-var">cs</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;^)&quot;</span></span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; String
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; String
</span><a href="#local-6989586621679685024"><span class="hs-identifier hs-var">escape</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679685006"><span class="hs-identifier hs-var">cs</span></a></span><span>
</span><span id="line-113"></span><span>    </span><span class="annot"><a href="#local-6989586621679685024"><span class="hs-identifier hs-var">escape</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Char
</span><span class="hs-char">'^'</span></span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span id="local-6989586621679685005"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679685005"><span class="hs-identifier hs-var">cs</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;^^&quot;</span></span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; String
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; String
</span><a href="#local-6989586621679685024"><span class="hs-identifier hs-var">escape</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679685005"><span class="hs-identifier hs-var">cs</span></a></span><span>
</span><span id="line-114"></span><span>    </span><span class="annot"><a href="#local-6989586621679685024"><span class="hs-identifier hs-var">escape</span></a></span><span> </span><span class="hs-special">(</span><span id="local-6989586621679685004"><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621679685004"><span class="hs-identifier hs-var">c</span></a></span></span><span>  </span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span id="local-6989586621679685003"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679685003"><span class="hs-identifier hs-var">cs</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621679685004"><span class="hs-identifier hs-var">c</span></a></span><span>     </span><span class="annot"><span class="annottext">Char -&gt; String -&gt; String
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span> </span><span class="annot"><span class="annottext">String -&gt; String
</span><a href="#local-6989586621679685024"><span class="hs-identifier hs-var">escape</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679685003"><span class="hs-identifier hs-var">cs</span></a></span><span>
</span><span id="line-115"></span></pre></body></html>